<?php
class PhotographerController extends \BaseController {

    public function index() {
        $photographers = User::whereRaw('role = ? and status = ?', array('3', 'active'))->get();

        $photographers = $this->getPhotographers();
        foreach($photographers as $key => $photographer) {
            $photographers[$key]->pictures = Picture::where('user_id', '=', $photographer->id)
                                                ->select(array('id', 'thumb'))->take(5)->get();

            $photographers[$key]->pictureCount = Picture::where('user_id', '=', $photographer->id)->count();
        }

        return View::make('front/photographers_index')
                        ->with('photographers', $photographers);

    }

    public function showIndex($username) {
        $photographer = User::whereRaw('role = ? and status = ? and username = ?', array('3', 'active', $username))->first();

		//升级处理blog事宜
		return '此模块正在升级中...';
        return View::make('front/photographer_index')
                        ->with('photographer', $photographer);
    }




    public function getPhotographers() {
        $photographers = User::whereRaw('role = ? and status = ?', array('3', 'active'))->get();


        return $photographers;
    }



}
